package com.cn.zmc.design.chian.disruptor.handle;

import com.cn.zmc.design.chian.domain.Trade;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.WorkHandler;
import org.springframework.stereotype.Component;


@Component
public class HandlerOneService implements EventHandler<Trade>, WorkHandler<Trade>{

	//EventHandler
	public void onEvent(Trade event, long sequence, boolean endOfBatch) throws Exception {
		this.onEvent(event);
	}

	//WorkHandler
	public void onEvent(Trade event) throws Exception {
		System.err.println("handler 1 : start");
		Thread.sleep(1000);
		event.setName("H1");
		System.err.println("handler 1 : end");
	}

}
